package qmm.demo;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

import org.apache.commons.dbcp2.BasicDataSource;

import com.mysql.jdbc.Connection;


@WebServlet("/DbcpTest")
public class DbcpTest{
	public static void main(String[] args){
			BasicDataSource bds = new BasicDataSource();
			bds.setDriverClassName("com.mysql.jdbc.Driver");
			bds.setUrl("jdbc:mysql://localhost:3306/test");
			bds.setUsername("root");
			bds.setPassword("admin");
			bds.setInitialSize(8);
			DataSource ds=bds;
			try{
			Connection conn=(Connection) ds.getConnection();
			System.out.print(conn);	
	}catch(SQLException e){
		e.printStackTrace();
	}
       
	}
    public DbcpTest() {
        super();
        // TODO Auto-generated constructor stub
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
